<template>
  <div class="plat-form-wrap">
    <div class="body-wrap home-mini-width infoUser">
      <TitleCard
        title="佛山市知识产权数据"
        :showMore="false"
        :loading="loading"
        :isEmpty="isEmpty"
        :isSwitch="false"
        :type="'threeCard'"
      >
        <MarketDemand
          :tableList="tableList"
          @detailClick="detailClick"
          :total="total"
          @pageChange="pageChange"
        ></MarketDemand>
      </TitleCard>
    </div>
  </div>
</template>

<script>
import MarketDemand from '@/components/common/MarketDemand'
import { mapGetters, mapMutations } from 'vuex'
import mixinsBackStack from '@/views/backstageSupport/mixins'
import { getFrontDataStatisticsList } from '../../api/dataStatistics'

export default {
  mixins: [mixinsBackStack],
  data() {
    return {
      params: {
        pageSize: 10,
        pageNum: 1,
      },
      loading: false,
      isEmpty: false,
      total: 0,
      tableList: []
    }
  },
  components: {
    MarketDemand,
  },
  computed: {
    ...mapGetters('user', ['visitor']),
  },
  mounted() {
    this.initSetting()
  },
  methods: {
    ...mapMutations('headerMenu', ['updateMenuItemStatus']),
    openLink(link) {
      window.open(link)
    },
    async initSetting() {
      const { rows, total } = await getFrontDataStatisticsList(this.params)
      this.total = total
      this.tableList = rows
    },
    toDetail(id) {
      this.$router.push({ name: 'generalInfoDetails', query: { id } })
    },
    pageChange(e) {
      this.params.pageNum = e
      this.initSetting()
    },
    detailClick(row) {
      this.$router.push({ name: 'patentStatisticsDetail', query: { id: row.id } })
    }
  }
}
</script>
